
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>2.5 HadoopHA配置 · GitBook</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        
        
        
    
    <link rel="stylesheet" href="../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">

    
    
    <link rel="prev" href="Zookeeper搭建.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../">
            
                <a href="../">
            
                    
                    Introduction
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" >
            
                <span>
            
                    
                    第一章 Hadoop环境搭建
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="../chapter1/1.1.html">
            
                <a href="../chapter1/1.1.html">
            
                    
                    1.1 安装JDK
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="../chapter1/1.2.html">
            
                <a href="../chapter1/1.2.html">
            
                    
                    1.2 Hadoop伪分布式安装
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.3" data-path="../chapter1/1.3.html">
            
                <a href="../chapter1/1.3.html">
            
                    
                    1.3 完全分布式环境搭建
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" >
            
                <span>
            
                    
                    第二章 Hadoop高可用
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="HadoopHA原理.html">
            
                <a href="HadoopHA原理.html">
            
                    
                    2.1 HadoopHA原理与机制
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="HadoopHA搭建规划.html">
            
                <a href="HadoopHA搭建规划.html">
            
                    
                    2.2 HadoopHA搭建规划 
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3" data-path="Zookeeper介绍.html">
            
                <a href="Zookeeper介绍.html">
            
                    
                    2.3 Zookeeper介绍
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.4" data-path="Zookeeper搭建.html">
            
                <a href="Zookeeper搭建.html">
            
                    
                    2.4 Zookeeper配置
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.3.5" data-path="HadoopHA配置.html">
            
                <a href="HadoopHA配置.html">
            
                    
                    2.5 HadoopHA配置
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" >
            
                <span>
            
                    
                    第三章 动态增删节点与常见配置
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="../chapter3/3.1集群节点动态增删.html">
            
                <a href="../chapter3/3.1集群节点动态增删.html">
            
                    
                    3.1 集群节点的动态增删
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.2" data-path="../chapter3/3.2常见错误与常用配置.html">
            
                <a href="../chapter3/3.2常见错误与常用配置.html">
            
                    
                    3.2 常见错误与常用配置
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href=".." >2.5 HadoopHA配置</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h1 id="hadoop&#x9AD8;&#x53EF;&#x7528;&#x914D;&#x7F6E;">Hadoop&#x9AD8;&#x53EF;&#x7528;&#x914D;&#x7F6E;</h1>
<h2 id="&#x4FEE;&#x6539;&#x914D;&#x7F6E;&#x6587;&#x4EF6;">&#x4FEE;&#x6539;&#x914D;&#x7F6E;&#x6587;&#x4EF6;</h2>
<p>&#x5728;&#x5B8C;&#x5168;&#x5206;&#x5E03;&#x5F0F;&#x7684;&#x57FA;&#x7840;&#x4E0A;&#x642D;&#x5EFA;&#x9AD8;&#x53EF;&#x7528;&#x4E3B;&#x8981;&#x4FEE;&#x6539;&#x7684;&#x662F;&#x4E24;&#x4E2A;&#x914D;&#x7F6E;&#x6587;&#x4EF6;&#xFF1A;<code>core-site.xml</code>&#xFF0C;<code>hdfs-site.xml</code></p>
<p>&#x9996;&#x5148;&#x4FEE;&#x6539;&#x7684;&#x662F;<strong>hadoop-master&#x673A;&#x5668;</strong>&#x7684; <code>core-site.xml</code>&#xFF0C;&#x5220;&#x9664;<code>fs.default.name</code>&#x5C5E;&#x6027;&#xFF0C;&#x52A0;&#x5165;&#x5982;&#x4E0B;&#x914D;&#x7F6E;&#xFF1A;</p>
<pre><code class="lang-xml"><span class="hljs-tag">&lt;<span class="hljs-name">configuration</span>&gt;</span>
    <span class="hljs-comment">&lt;!-- &#x6307;&#x5B9A;hdfs&#x7684;nameservice&#x4E3A;ns1 --&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">property</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">name</span>&gt;</span>fs.defaultFS<span class="hljs-tag">&lt;/<span class="hljs-name">name</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">value</span>&gt;</span>hdfs://ns1/<span class="hljs-tag">&lt;/<span class="hljs-name">value</span>&gt;</span>
    <span class="hljs-tag">&lt;/<span class="hljs-name">property</span>&gt;</span>
    <span class="hljs-comment">&lt;!-- &#x6307;&#x5B9A;hadoop&#x4E34;&#x65F6;&#x76EE;&#x5F55; --&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">property</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">name</span>&gt;</span>hadoop.tmp.dir<span class="hljs-tag">&lt;/<span class="hljs-name">name</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">value</span>&gt;</span>/usr/hadoop/namenode<span class="hljs-tag">&lt;/<span class="hljs-name">value</span>&gt;</span>
        <span class="hljs-tag">&lt;/<span class="hljs-name">property</span>&gt;</span>
    <span class="hljs-comment">&lt;!-- &#x6307;&#x5B9A;zookeeper&#x5730;&#x5740; --&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">property</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">name</span>&gt;</span>ha.zookeeper.quorum<span class="hljs-tag">&lt;/<span class="hljs-name">name</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">value</span>&gt;</span>hadoop-back:2181,hadoop-slave2:2181,hadoop-slave3:2181<span class="hljs-tag">&lt;/<span class="hljs-name">value</span>&gt;</span>
    <span class="hljs-tag">&lt;/<span class="hljs-name">property</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">configuration</span>&gt;</span>
</code></pre>
<p>&#x63A5;&#x4E0B;&#x6765;&#x7F16;&#x8F91;<code>hdfs-site.xml</code>&#x6587;&#x4EF6;&#xFF1A;</p>
<pre><code class="lang-xml"><span class="hljs-tag">&lt;<span class="hljs-name">configuration</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">property</span>&gt;</span>  
        <span class="hljs-tag">&lt;<span class="hljs-name">name</span>&gt;</span>dfs.name.dir<span class="hljs-tag">&lt;/<span class="hljs-name">name</span>&gt;</span>  
        <span class="hljs-tag">&lt;<span class="hljs-name">value</span>&gt;</span>/usr/hadoop/hdfs/name<span class="hljs-tag">&lt;/<span class="hljs-name">value</span>&gt;</span>  
        <span class="hljs-tag">&lt;<span class="hljs-name">description</span>&gt;</span>namenode&#x4E0A;&#x5B58;&#x50A8;hdfs&#x540D;&#x5B57;&#x7A7A;&#x95F4;&#x5143;&#x6570;&#x636E; <span class="hljs-tag">&lt;/<span class="hljs-name">description</span>&gt;</span>   
<span class="hljs-tag">&lt;/<span class="hljs-name">property</span>&gt;</span>  
<span class="hljs-tag">&lt;<span class="hljs-name">property</span>&gt;</span>  
        <span class="hljs-tag">&lt;<span class="hljs-name">name</span>&gt;</span>dfs.data.dir<span class="hljs-tag">&lt;/<span class="hljs-name">name</span>&gt;</span>  
        <span class="hljs-tag">&lt;<span class="hljs-name">value</span>&gt;</span>/usr/hadoop/hdfs/data<span class="hljs-tag">&lt;/<span class="hljs-name">value</span>&gt;</span>  
        <span class="hljs-tag">&lt;<span class="hljs-name">description</span>&gt;</span>datanode&#x4E0A;&#x6570;&#x636E;&#x5757;&#x7684;&#x7269;&#x7406;&#x5B58;&#x50A8;&#x4F4D;&#x7F6E;<span class="hljs-tag">&lt;/<span class="hljs-name">description</span>&gt;</span>  
<span class="hljs-tag">&lt;/<span class="hljs-name">property</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">property</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">name</span>&gt;</span>dfs.replication<span class="hljs-tag">&lt;/<span class="hljs-name">name</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">value</span>&gt;</span>3<span class="hljs-tag">&lt;/<span class="hljs-name">value</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">property</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">property</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">name</span>&gt;</span>dfs.permissions.enabled<span class="hljs-tag">&lt;/<span class="hljs-name">name</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">value</span>&gt;</span>false<span class="hljs-tag">&lt;/<span class="hljs-name">value</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">property</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">property</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">name</span>&gt;</span>dfs.nameservices<span class="hljs-tag">&lt;/<span class="hljs-name">name</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">value</span>&gt;</span>ns1<span class="hljs-tag">&lt;/<span class="hljs-name">value</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">property</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">property</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">name</span>&gt;</span>dfs.blocksize<span class="hljs-tag">&lt;/<span class="hljs-name">name</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">value</span>&gt;</span>134217728<span class="hljs-tag">&lt;/<span class="hljs-name">value</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">property</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">property</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">name</span>&gt;</span>dfs.ha.namenodes.ns1<span class="hljs-tag">&lt;/<span class="hljs-name">name</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">value</span>&gt;</span>nn1,nn2<span class="hljs-tag">&lt;/<span class="hljs-name">value</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">property</span>&gt;</span>
<span class="hljs-comment">&lt;!-- nn1&#x7684;RPC&#x901A;&#x4FE1;&#x5730;&#x5740;&#xFF0C;nn1&#x6240;&#x5728;&#x5730;&#x5740;  --&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">property</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">name</span>&gt;</span>dfs.namenode.rpc-address.ns1.nn1<span class="hljs-tag">&lt;/<span class="hljs-name">name</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">value</span>&gt;</span>hadoop-master:8020<span class="hljs-tag">&lt;/<span class="hljs-name">value</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">property</span>&gt;</span>
<span class="hljs-comment">&lt;!-- nn1&#x7684;http&#x901A;&#x4FE1;&#x5730;&#x5740;&#xFF0C;&#x5916;&#x90E8;&#x8BBF;&#x95EE;&#x5730;&#x5740; --&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">property</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">name</span>&gt;</span>dfs.namenode.http-address.ns1.nn1<span class="hljs-tag">&lt;/<span class="hljs-name">name</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">value</span>&gt;</span>hadoop-master:9870<span class="hljs-tag">&lt;/<span class="hljs-name">value</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">property</span>&gt;</span>
<span class="hljs-comment">&lt;!-- nn2&#x7684;RPC&#x901A;&#x4FE1;&#x5730;&#x5740;&#xFF0C;nn2&#x6240;&#x5728;&#x5730;&#x5740; --&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">property</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">name</span>&gt;</span>dfs.namenode.rpc-address.ns1.nn2<span class="hljs-tag">&lt;/<span class="hljs-name">name</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">value</span>&gt;</span>hadoop-back:8020<span class="hljs-tag">&lt;/<span class="hljs-name">value</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">property</span>&gt;</span>
<span class="hljs-comment">&lt;!-- nn2&#x7684;http&#x901A;&#x4FE1;&#x5730;&#x5740;&#xFF0C;&#x5916;&#x90E8;&#x8BBF;&#x95EE;&#x5730;&#x5740; --&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">property</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">name</span>&gt;</span>dfs.namenode.http-address.ns1.nn2<span class="hljs-tag">&lt;/<span class="hljs-name">name</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">value</span>&gt;</span>hadoop-back:9870<span class="hljs-tag">&lt;/<span class="hljs-name">value</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">property</span>&gt;</span>

 <span class="hljs-comment">&lt;!--namenode1 RPC&#x7AEF;&#x53E3; --&gt;</span>

<span class="hljs-comment">&lt;!-- &#x6307;&#x5B9A;NameNode&#x7684;&#x5143;&#x6570;&#x636E;&#x5728;JournalNode&#x65E5;&#x5FD7;&#x4E0A;&#x7684;&#x5B58;&#x653E;&#x4F4D;&#x7F6E;(&#x4E00;&#x822C;&#x548C;zookeeper&#x90E8;&#x7F72;&#x5728;&#x4E00;&#x8D77;) --&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">property</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">name</span>&gt;</span>dfs.namenode.shared.edits.dir<span class="hljs-tag">&lt;/<span class="hljs-name">name</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">value</span>&gt;</span>qjournal://hadoop-back:8485;hadoop-slave2:8485;hadoop-slave3:8485/ns1<span class="hljs-tag">&lt;/<span class="hljs-name">value</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">property</span>&gt;</span>
<span class="hljs-comment">&lt;!-- &#x6307;&#x5B9A;JournalNode&#x5728;&#x672C;&#x5730;&#x78C1;&#x76D8;&#x5B58;&#x653E;&#x6570;&#x636E;&#x7684;&#x4F4D;&#x7F6E; --&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">property</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">name</span>&gt;</span>dfs.journalnode.edits.dir<span class="hljs-tag">&lt;/<span class="hljs-name">name</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">value</span>&gt;</span>/usr/hadoop/journal<span class="hljs-tag">&lt;/<span class="hljs-name">value</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">property</span>&gt;</span>
<span class="hljs-comment">&lt;!--&#x5BA2;&#x6237;&#x7AEF;&#x901A;&#x8FC7;&#x4EE3;&#x7406;&#x8BBF;&#x95EE;namenode&#xFF0C;&#x8BBF;&#x95EE;&#x6587;&#x4EF6;&#x7CFB;&#x7EDF;&#xFF0C;HDFS &#x5BA2;&#x6237;&#x7AEF;&#x4E0E;Active &#x8282;&#x70B9;&#x901A;&#x4FE1;&#x7684;Java &#x7C7B;&#xFF0C;&#x4F7F;&#x7528;&#x5176;&#x786E;&#x5B9A;Active &#x8282;&#x70B9;&#x662F;&#x5426;&#x6D3B;&#x8DC3;  --&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">property</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">name</span>&gt;</span>dfs.client.failover.proxy.provider.ns1<span class="hljs-tag">&lt;/<span class="hljs-name">name</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">value</span>&gt;</span>org.apache.hadoop.hdfs.server.namenode.ha.ConfiguredFailoverProxyProvider<span class="hljs-tag">&lt;/<span class="hljs-name">value</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">property</span>&gt;</span>
<span class="hljs-comment">&lt;!--&#x8FD9;&#x662F;&#x914D;&#x7F6E;&#x81EA;&#x52A8;&#x5207;&#x6362;&#x7684;&#x65B9;&#x6CD5; --&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">property</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">name</span>&gt;</span>dfs.ha.fencing.methods<span class="hljs-tag">&lt;/<span class="hljs-name">name</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">value</span>&gt;</span>sshfence<span class="hljs-tag">&lt;/<span class="hljs-name">value</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">property</span>&gt;</span>
<span class="hljs-comment">&lt;!-- &#x8FD9;&#x4E2A;&#x662F;&#x4F7F;&#x7528;sshfence&#x9694;&#x79BB;&#x673A;&#x5236;&#x65F6;&#x624D;&#x9700;&#x8981;&#x914D;&#x7F6E;ssh&#x514D;&#x767B;&#x9646; --&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">property</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">name</span>&gt;</span>dfs.ha.fencing.ssh.private-key-files<span class="hljs-tag">&lt;/<span class="hljs-name">name</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">value</span>&gt;</span>/usr/hadoop/.ssh/id_rsa<span class="hljs-tag">&lt;/<span class="hljs-name">value</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">property</span>&gt;</span>
<span class="hljs-comment">&lt;!-- &#x914D;&#x7F6E;sshfence&#x9694;&#x79BB;&#x673A;&#x5236;&#x8D85;&#x65F6;&#x65F6;&#x95F4;&#xFF0C;&#x8FD9;&#x4E2A;&#x5C5E;&#x6027;&#x540C;&#x4E0A;&#xFF0C;&#x5982;&#x679C;&#x4F60;&#x662F;&#x7528;&#x811A;&#x672C;&#x7684;&#x65B9;&#x6CD5;&#x5207;&#x6362;&#xFF0C;&#x8FD9;&#x4E2A;&#x5E94;&#x8BE5;&#x662F;&#x53EF;&#x4EE5;&#x4E0D;&#x914D;&#x7F6E;&#x7684; --&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">property</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">name</span>&gt;</span>dfs.ha.fencing.ssh.connect-timeout<span class="hljs-tag">&lt;/<span class="hljs-name">name</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">value</span>&gt;</span>30000<span class="hljs-tag">&lt;/<span class="hljs-name">value</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">property</span>&gt;</span>
<span class="hljs-comment">&lt;!-- &#x8FD9;&#x4E2A;&#x662F;&#x5F00;&#x542F;&#x81EA;&#x52A8;&#x6545;&#x969C;&#x8F6C;&#x79FB;&#xFF0C;&#x5982;&#x679C;&#x4F60;&#x6CA1;&#x6709;&#x81EA;&#x52A8;&#x6545;&#x969C;&#x8F6C;&#x79FB;&#xFF0C;&#x8FD9;&#x4E2A;&#x53EF;&#x4EE5;&#x5148;&#x4E0D;&#x914D; --&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">property</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">name</span>&gt;</span>dfs.ha.automatic-failover.enabled<span class="hljs-tag">&lt;/<span class="hljs-name">name</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">value</span>&gt;</span>true<span class="hljs-tag">&lt;/<span class="hljs-name">value</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">property</span>&gt;</span>    
<span class="hljs-tag">&lt;/<span class="hljs-name">configuration</span>&gt;</span>
</code></pre>
<p>&#x914D;&#x7F6E;&#x6587;&#x4EF6;&#x4FEE;&#x6539;&#x5B8C;&#x6BD5;&#xFF0C;&#x5C06;&#x4EE5;&#x4E0A;&#x505A;&#x7684;&#x4FEE;&#x6539;&#x540C;&#x6B65;&#x5230;&#x5176;&#x4ED6;3&#x53F0;&#x4E3B;&#x673A;&#x4E0A;&#x3002;</p>
<h2 id="&#x542F;&#x52A8;&#x96C6;&#x7FA4;">&#x542F;&#x52A8;&#x96C6;&#x7FA4;</h2>
<h3 id="1&#x542F;&#x52A8;zookeeper&#x96C6;&#x7FA4;">1.&#x542F;&#x52A8;Zookeeper&#x96C6;&#x7FA4;</h3>
<p>&#x5728;&#x5B50;&#x8282;&#x70B9;<strong>hadoop-back,hadoop-slave2, hadoop-slave3</strong>&#x8282;&#x70B9;&#x4E2D;&#x5207;&#x6362;&#x81F3;hadoop&#x76EE;&#x5F55;&#x5E76;&#x6267;&#x884C;&#x5982;&#x4E0B;&#x547D;&#x4EE4;:</p>
<pre><code>./bin/zkServer.sh start
</code></pre><h3 id="2&#x683C;&#x5F0F;&#x5316;zk&#x96C6;&#x7FA4;">2.&#x683C;&#x5F0F;&#x5316;zk&#x96C6;&#x7FA4;</h3>
<p>hadoop-master&#x4E0A;&#x6267;&#x884C;:</p>
<pre><code>/bin/hdfs zkfc -formatZK
</code></pre><h3 id="3&#x542F;&#x52A8;journalnode&#x96C6;&#x7FA4;">3.&#x542F;&#x52A8;journalnode&#x96C6;&#x7FA4;</h3>
<p>&#x5B50;&#x8282;&#x70B9;&#xFF1A;<strong>hadoop-back,hadoop-slave2, hadoop-slave3</strong>&#x4E0A;&#x6267;&#x884C;&#xFF1A;</p>
<pre><code> ./sbin/hadoop-daemon.sh  start journalnode
</code></pre><h3 id="4&#x683C;&#x5F0F;&#x5316;namenode&#xFF08;&#x5982;&#x679C;&#x4E4B;&#x524D;&#x5DF2;&#x7ECF;&#x683C;&#x5F0F;&#x5316;&#x53EF;&#x4EE5;&#x8003;&#x8651;&#x5220;&#x9664;&#x76F8;&#x5173;&#x6587;&#x4EF6;&#x5939;&#xFF09;">4.&#x683C;&#x5F0F;&#x5316;<code>namenode</code>&#xFF08;&#x5982;&#x679C;&#x4E4B;&#x524D;&#x5DF2;&#x7ECF;&#x683C;&#x5F0F;&#x5316;&#x53EF;&#x4EE5;&#x8003;&#x8651;&#x5220;&#x9664;&#x76F8;&#x5173;&#x6587;&#x4EF6;&#x5939;&#xFF09;:</h3>
<pre><code>./bin/hdfs namenode -format
</code></pre><h3 id="5&#x542F;&#x52A8;datanode">5.&#x542F;&#x52A8;datanode</h3>
<p><strong>hadoop-back</strong>, <strong>hadoop-slave2</strong>, <strong>hadoop-slave3</strong>&#x4E0A;&#x6267;&#x884C;&#xFF1A;</p>
<pre><code> ./sbin/hadoop-daemon.sh start datanode
</code></pre><h3 id="6&#x3001;&#x542F;&#x52A8;namenode">6&#x3001;&#x542F;&#x52A8;namenode</h3>
<p><strong>hadoop-master</strong>:</p>
<pre><code> ./sbin/hadoop-daemon.sh start namenode
</code></pre><p><strong>hadoop-back</strong>:</p>
<pre><code>./bin/hdfs namenode -bootstrapStandby
./sbin/hadoop-daemon.sh start namenode
</code></pre><p>&#x6B64;&#x65F6;<code>namenode1(hadoop-master)</code>&#x548C;<code>namenode2(hadoop-back)</code>&#x540C;&#x65F6;&#x5904;&#x4E8E;<code>standby</code>&#x72B6;&#x6001;&#x3002;</p>
<pre><code>$hdfs haadmin -getServiceState nn1 (&#x67E5;&#x770B;hadoop-master&#x7684;namenode&#x72B6;&#x6001;)
$hdfs haadmin -getServiceState nn2(&#x67E5;&#x770B;hadoop-master2&#x7684;namenode&#x72B6;&#x6001;)
</code></pre><h3 id="7&#x3001;&#x542F;&#x52A8;zkfc&#x670D;&#x52A1;">7&#x3001;&#x542F;&#x52A8;zkfc&#x670D;&#x52A1;</h3>
<p>&#x5728;<code>namenode1(hadoop-master)</code>&#x548C;<code>namenode2(hadoop-back)</code>&#x4E0A;&#x540C;&#x65F6;&#x6267;&#x884C;&#x5982;&#x4E0B;&#x547D;&#x4EE4;&#xFF1A;</p>
<pre><code>./sbin/hadoop-daemon.sh  start zkfc
</code></pre><h3 id="8&#x3001;&#x9A8C;&#x8BC1;">8&#x3001;&#x9A8C;&#x8BC1;</h3>
<p>&#x6740;&#x6B7B;<code>hadoop-master</code>&#x7684;<code>namenode</code>&#x8282;&#x70B9;&#x67E5;&#x770B;<code>hadoop-back</code>&#x662F;&#x5426;&#x80FD;&#x4ECE;<code>standby</code>&#x72B6;&#x6001;&#x5207;&#x6362;&#x81F3;<code>active</code>&#x3002;</p>
<p>&#x6709;&#x65F6;&#x5019;&#x9700;&#x8981;&#x624B;&#x52A8;&#x5207;&#x6362;&#x72B6;&#x6001;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;&#xFF1A;</p>
<pre><code>$ bin/hdfs haadmin -transitionToActive nn1 ##&#x5207;&#x6362;&#x6210;active
$ bin/hdfs haadmin -transitionToStandby nn1 ##&#x5207;&#x6362;&#x6210;standby
</code></pre>
                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="Zookeeper搭建.html" class="navigation navigation-prev navigation-unique" aria-label="Previous page: 2.4 Zookeeper配置">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"2.5 HadoopHA配置","level":"1.3.5","depth":2,"next":{"title":"第三章 动态增删节点与常见配置","level":"1.4","depth":1,"ref":"","articles":[{"title":"3.1 集群节点的动态增删","level":"1.4.1","depth":2,"path":"chapter3/3.1集群节点动态增删.md","ref":"chapter3/3.1集群节点动态增删.md","articles":[]},{"title":"3.2 常见错误与常用配置","level":"1.4.2","depth":2,"path":"chapter3/3.2常见错误与常用配置.md","ref":"chapter3/3.2常见错误与常用配置.md","articles":[]}]},"previous":{"title":"2.4 Zookeeper配置","level":"1.3.4","depth":2,"path":"chapter2/Zookeeper搭建.md","ref":"chapter2/Zookeeper搭建.md","articles":[]},"dir":"ltr"},"config":{"gitbook":"*","theme":"default","variables":{},"plugins":[],"pluginsConfig":{"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"}},"file":{"path":"chapter2/HadoopHA配置.md","mtime":"2019-05-06T16:09:44.731Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2019-05-06T16:09:52.649Z"},"basePath":"..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../gitbook/gitbook.js"></script>
    <script src="../gitbook/theme.js"></script>
    
        
        <script src="../gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

